<?php

/**
 * Arrow resource linker ( for template resources tags ) 
 * 
 * @version 1.0
 * @license  GNU GPL
 * @author Artur Kmera <artur.kmera@arrowplatform.org> 
 */
class ArrowResourceLinker implements IArrowControlsManager{


	/**
	 * Resources structure handle
	 * 
	 * @var ArrowResources
	 */
	private $resHandle;
	

	
	/**
	 * Instance
	 * 
	 * @var ArrowResourceLinker
	 */
	private static  $selfInstance = null;

	/**
	 * Singleton !NO_REMOTE
	 * 
	 * @return ArrowResourceLinker
	 */
	public static function getDefault( ) {
		if (self :: $selfInstance == null ) {
			self :: $selfInstance = new ArrowResourceLinker();
		}
		return self :: $selfInstance;
	}
	
	/**
	 * Constructor sets index file from router
	 */
	private function __construct(){
		$this->resHandle = ArrowRouter::getDefault()->getProject()->getResources();
	}
	
	/**
	 * Handle for template link:template tags
	 *
	 * @param String[] $args
	 * @return String
	 */	
	public function generateResourceLink( $args ){
		return $this->resHandle->getResource( $args["path"] )->getRelativePath();
	}
	
	public function getControlVersionsConf($prefix,$tag){
		return array(
			"resource" => array(
				"params" => array(
					"path"
				)
			) 
		);
	}
	
}
?>
